package com.tian.job.station;

import com.tian.common.enums.RetryMessageTypeEnum;
import com.tian.common.util.RabbitMQConstant;
import com.tian.job.BaseRetryMessageJobService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * {@code @description:} 已使用优惠券定时任务【补偿发送MQ消息】
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2025-03-19 22:19
 * {@code @version:} 1.0
 */
@Slf4j
@Component
public class ChargeOrderStatusUpdateJob {

    @Resource
    private BaseRetryMessageJobService baseRetryMessageJobService;

    @Scheduled(cron = "${job.cron.user-using-coupon-job}")
    public void execute() {
        Integer type = RetryMessageTypeEnum.CHARGE_ORDER_STATUS_UPDATE.getType();
        Integer status = 0;
        String mqExchange = RabbitMQConstant.CHARGING_ORDER_STATUS_CHANGE_EXCHANGE;
        String mqRoutingKey = RabbitMQConstant.CHARGING_ORDER_STATUS_CHANGE_ROUTING_KEY;
        baseRetryMessageJobService.retryMessageToMQ(type, status, mqExchange, mqRoutingKey);
    }
}
